package dat02;

import java.util.regex.Pattern;
import java.util.regex.Matcher;

public class Test06 {
    /**
     * 测试正则表达式，并尝试编写规则: 电话号码可能有3-4位区号，7-8位号码:0415-5561111
     * @author Admin
     *
     */
    public static void main(String[] args) {
        String str = "0415-5561111";
        String path = "\\d{3,4}-\\d{7,8}";
        Pattern p = Pattern.compile(path);
        Matcher m = p.matcher(str);
        if (m.find()){
            System.out.println("匹配成功");
        }else
            System.out.println("匹配失败");

    }

}
